<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title><%= title %></title>
    
	<% include ../includes/head%>
    <style>
        .form-horizontal .control-label{
            padding-top: 0
        }
    </style>
</head>
<body>
	<% include ../includes/header%>
	
	<div id="container-inner">
		<ul id="breadcrumb-wrapper">
        
	    	<li>
	            <a href="index.html">
                <ins>
				    <div class="br-left"></div>
				    <div class="br-mid">
				    	主页
				    </div><!--br-mid-->
				    <div class="br-right">
				    </div><!--br-right-->
                </ins>    
		        </a>
            </li>  
            
            <li>
	            <a href="blog.html">
                <ins>
				    <div class="br-left"></div>
				    <div class="br-mid">
				    	订单列表
				    </div><!--br-mid-->
				    <div class="br-right">
				    </div><!--br-right-->
                </ins>    
		        </a>
            </li>
            
           
            <li id="page-title">
          		订单列表
        	</li><!--page-title-->
        </ul>
        <div id="inner-border"></div>
        <div class="clear"></div>
        <div id="contentwrap-inner">
        <%if(orders.length == 0){%>
        <div>暂无订单</div>
        <%}%>
        	<div>
                <% for(var i = 0; i < orders.length; i++){%>
                <h1 style="border: 1px solid #ccc;background: #eee; border-radius: 5px 5px 0 0; padding:10px; box-shadow: 0 0 8px #ccc">订单<%= i+1 %></h1>
                <div class="form-horizontal" style="padding-bottom:20px;margin-bottom: 20px; border: 1px solid #ccc; box-shadow: 0 0 8px #ccc; padding:10px">
                    
                    <div class="form-group">
                        <label for="inputName" class="col-sm-2 control-label">用户名：</label>
                        <div class="col-sm-10">
                            <span><%= orders[i].uName%></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputName" class="col-sm-2 control-label">收货人：</label>
                        <div class="col-sm-10">
                            <span><%= orders[i].ordername%></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputloc" class="col-sm-2 control-label">收货地址：</label>
                        <div class="col-sm-10">
                            <span><%= orders[i].location%></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputtel" class="col-sm-2 control-label">电话：</label>
                        <div class="col-sm-10">
                            <span><%= orders[i].tel%></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputtel" class="col-sm-2 control-label">订单号：</label>
                        <div class="col-sm-10">
                            <span><%= orders[i]._id%></span>
                        </div>
                    </div>
                    
                    <div >
                        <table class="table table-bordered">
                          <tr>
                              <th>商品</th>
                              <th>价格</th>
                              <th>数量</th>
                          </tr>
                          
                          <% for(var j = 0; j < orders[i].cart.length; j++){%>
                          <tr>
                             <td>
                                 <img class="li-img a img" src="/upload/<%=orders[i].cart[j].cImgSrc%>" width="20">
                                 <%=orders[i].cart[j].cName%>
                             </td> 
                             <td><%=orders[i].cart[j].cPrice%></td>
                             <td><%=orders[i].cart[j].cQuantity%></td>
                             
                             
                          </tr>
                          <%}%>
                        </table>
                        
                        <div style="height: 35px;">
                        	<span style="margin-right: 540px">
                        		总计：<span id="money" style="color: red;font-size: 25px">￥<%= orders[i].total %>.00</span>
                        	</span>
                            <%if(orders[i].pay){%>

                            	<%if(orders[i].cStatus == 0){%>
                                <a href="/confirmOrder/<%= orders[i]._id %>" class="btn btn-success">确认收货</a>
                                <a href="/concelOrder/<%= orders[i]._id %>" class="btn btn-danger">取消订单</a>
                        		
                        		<%}else if(orders[i].cStatus == 1){%>
                        		  <span>商品已确认收货</span>
                        		

                        		<%}else if(orders[i].cStatus == 2){%>
                        		<span>商品已取消订单</span>
                        		<%}%>
                            <%}else{%>
                                <span>该商品未付款</span>
                                <a href="/order/<%= orders[i]._id %>" class="btn btn-success">去付款</a>
                            <%}%>
                            
                        </div>
                    </div>
                    
                    <!-- <div class="form-group">
                        <div class="col-sm-offset-2 col-sm-10">
                            <button type="submit">录入</button>
                        </div>
                    </div> -->

                </div>
                <%}%>
            </div>
			
			<div class="clear"></div>
        </div>		
	</div>
	<% include ../includes/footer%>
</body>
</html>